package foo.bar.db.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = "employee") //определять коллекцию, если не подходит имя класса как имя коллекции
public class Employee {
    @Id
    private String id;
    private String name;

    public String getDateFinish() {
        return dateFinish;
    }

    private String dateFinish;

    @DBRef
    private Person person;
    int age;
    public Employee(String name, Person person, int age) {
        this.name = name;
        this.person = person;
        this.age = age;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }


    public void setAge(int age) {
        this.age = age;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", person=" + person +
                ", age=" + age +
                '}';
    }
}
